﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/css/rightdirectory.css?v=4559">
    <link href="js/valid/css/tr.css" rel="stylesheet" />
    <script src="js/list-config.js"></script>
    <script src="js/valid/form-valid.js"></script>
    <script src="/js/list-config.js?33456"></script>
    <title></title>
</head>

<body>
    <div class="form-head">
        <h1>
            <i class="icon  icon-spin icon-wrench icon-2x"></i>&nbsp;快捷模块</h1>
        <hr />
    </div>
    <div class="form-body">
        <div class="form-horizontal">
            <div class="form-group">
                <label class="col-sm-2">账号</label>
                <div class="col-md-6 col-sm-10">
                    <input type="text" class="form-control" placeholder="电子邮件/手机号/用户名" value="@Model.PhoneNumber" data-form="PhoneNumber">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2">密码</label>
                <div class="col-md-6 col-sm-10">
                    <input type="password" class="form-control" placeholder="密码" value="@Model.Password" data-form="Password">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2">密码原值</label>
                <div class="col-md-6 col-sm-10">
                    <input type="password" class="form-control" placeholder="密码" value="@Model.PasswordSalt" data-form="PasswordSalt">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <div>
                        <label class="checkbox-reset">
                        <input type="checkbox">
                        <span>记住我</span>
                    </label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <div>
                        <label class="radio-reset">
                        <input type="radio" name="n">
                        <span>单选1</span>
                    </label>
                        <label class="radio-reset">
                        <input type="radio" name="n">
                        <span>单选2</span>
                    </label>
                        <label class="radio-reset">
                        <input type="radio" name="n">
                        <span>单选3</span>
                    </label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2">演示图片上传</label>
                <div class="col-md-6 col-sm-10">
                    <div class="img-group">
                        <div class="example">
                            <img src="f/img/default/null.jpg" id="user-img" data-form="img&src" style="width:200px;height:150px">
                        </div>
                    </div>
                    <div class="img-group-btn">
                        <input type="button" id="btn-img-upload" class="btn btn-sm btn-primary" value="上传" />
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2">富文本框演示</label>
                <div class="col-md-6 col-sm-10">
                    <textarea id="ueditor-content"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="button" id="btn-submit" class="btn btn-primary">保存</button>
                    <button type="button" class="btn" onclick="window.history.go(-1)">退出</button>
                </div>
            </div>
        </div>
    </div>
    <div class="form-bottom"></div>
</body>

</html>
<script src="/plugins/ue/ue-all.config.js"></script>
<script src="/plugins/ue/ueditor.all.min.js"></script>
<script src="/plugins/upload/js/webuploader-lib-config.js"></script>
<script src="/plugins/upload/js/webuploader-min.js"></script>
<script src="/plugins/upload/js/webuploader-lib.js"></script>


<script type="text/javascript">
    var _UE = UE.getEditor("ueditor-content");

    _UE.ready(function() {
        _UE.setContent("富文本框内容");


    })
    $(function() {
        //初始化验证
        // 具体参考 http://validform.rjboy.cn/document.html
        var formValidData = [{
            key: "PhoneNumber",
            datatype: "m",
            nullmsg: "不允许为空",
            errormsg: "错误的手机号码格式"
        }, {
            key: "Password",
            datatype: "*6-16",
            nullmsg: "不允许为空",
            errormsg: "检测是否为6到16位任意字符"
        }];

        //绑定验证
        var formValidEvent = $(".form-body").formValid("", formValidData);

        //提交
        $("#btn-submit").click(function() {

            //获取富文本框值
            var ueContent = _UE.getContent();

            if (!formValidEvent.check()) {
                return;
            }
            $(".form-body").ajaxFormSubmit("/Demo/Form", function(d) {
                if (d > 0) {
                    $.msgSucceed("保存成功");
                    return;
                }
                $.msgFall("保存失败");
            }, {
                addData: {
                    Id: _Id
                }
            });
        })

        //上传图片
        $("#btn-img-upload").click(function() {
            $.WebUploader({
                uploader: { //图片上传配置
                    fileNumLimit: 1000024, // 验证文件总数量, 超出则不允许加入队列
                    fileSingleSizeLimit: 1230000000, //验证单个文件大小是否超出限制,单位计算/b
                    succee: function(rs) {
                        $("#user-img").attr("src", rs.url);
                    }
                }
            })
        })

    })
</script>